﻿using System;
using System.Configuration;
using System.Data.SqlClient;
using System.Linq;

namespace Web.Step05
{
   public partial class Default : AppPage
   {
      protected void Page_Load(object sender, EventArgs e)
      {
         if (IsPostBack) return;

         using (var conn = new SqlConnection(ConfigurationManager.ConnectionStrings["TheDatabaseConnectionString"].ConnectionString))
         {
            var context = new ProductClassesDataContext(conn);

            dg.DataSource = from p in context.Products select p;
            dg.DataBind();
         }
      }
   }
}